<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    // 1.基本演练
    const names = ['张三', '李四', '王五']
    const str = "Hello"
    function foo(name1, name2, ...args) {
      console.log(name1, name2, args)
    }
    foo(...names)
    foo(...str)

    const obj = {
      name: 'why',
      age: 18
    }
    // foo(...obj) // 在函数的调用时,用展开运算符,将对应的展开数据,进行迭代
    // 可迭代对象: 数组/string/arguments

    const info = {
      ...obj,
      height: 1.88,
      address: '北京'
    }
    console.log(info)


  </script>
</body>

</html>